<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title></title>
  	<script type="text/javascript" src="js/jquery-1.8.2.js"></script> 
    <script type="text/javascript" src="js/common.js"></script> 
	<script type="text/javascript" src="js/jquery.form.js"></script>
</head>
  <body>
 
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">供应商添加</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9">
    	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	      <tr>
	        <td colspan="2" valign="top">
	      		<!--  控件按钮栏-->
		         <TABLE class=main_tab id=mainTable cellSpacing=0 cellPadding=0 width=100% border=0>
		             <tr>
		             	<td>
		                 	 <input type="button" name="saveSupplier"  id="saveSupplier"  value="保存" onclick="submitForm()">
		                </td>
		             </tr>
			      </TABLE>
		     </td>
		     <td>&nbsp;</td>
		  </tr>
		  <tr>
	        <td height="40" colspan="4">
	        	<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
			          <tr>
			            <td></td>
			          </tr>
	        	</table>
	        </td>
		  </tr>
		  <tr>
		  	 <td colspan="30">
		     <!--  table栏-->
		      <form id="saveSupplierForm" action="<%=basePath%>/supplierAction_saveSupplier.action"  method="post">
				    <table align="left">  
				      <tr>
					       	<td> 供应商编号:</td>
					       	<td> <input type="text"  id="stSupplierNumber"  name="supplierBean.stSupplierNumber"  /><font size="5" color="#FF4500">*</font></td>
					       	<td> 供应商名称: </td>
					       	<td> <input type="text"  id="stSupplierName"  name="supplierBean.stSupplierName"  /><font size="5" color="#FF4500">*</font></td>
					  </tr>
					  <tr>
					   
					  		<c:set var="resultList" scope="request" value="${areaPart}"/>
					  		<td>供应商所在地区：</td>
					  		<td>
					  			<select  id="stAreaPart"  name="areaBean.stAreaPart" style="width:150px">
					  			<option value="" selected></option>
						  			<c:choose> 
								  		<c:when test="${not empty resultList}">
									  		<c:forEach items="${resultList}"  var="op">  
											   <option value="${op}">${op}</option>
											</c:forEach> 
								  		</c:when>
								  	</c:choose>
							  	</select>
					  		</td>
					  		<td>供应商所在省市：</td>
					  		<td>
					  			<select  id="stAreaType"  name="areaBean.stAreaType" style="width:150px">
					  			</select>
					  		</td>
					  		<td>供应商所在城市名称：</td>
					  		<td>
					  			<select  id="stAreaName"  name="areaBean.stAreaName" style="width:150px">
					  			</select>
					  		</td>
					       	<td> <input type="hidden"  id="stArea"  name="supplierBean.stSupplierArea"  /></td>
					       
					  </tr>
					   <tr>
					   		<td>商户所在地址：</td>
					       	<td> <input type="text"  id="stSupplierAddress"  name="supplierBean.stSupplierAddress"  /></td>
					  		<td>供应商所在区域邮编：</td>
					  		<td><input type="text"  id="stSupplierPostCode"  name="supplierBean.stSupplierPostCode"  /></td>
					       	
					  </tr>
					  <tr>
					  		<td>供应商固定电话：</td>
					       	<td> <input type="text"  id="stSupplierPhone"  name="supplierBean.stSupplierPhone"  /></td>
					  		<td>供应商移动电话：</td>
					       	<td> <input type="text"  id="stSupplierMobile"  name="supplierBean.stSupplierMobile"  /></td>
					       	<td>供应商邮箱：</td>
					       	<td> <input type="text"  id="stSupplierEmail"  name="supplierBean.stSupplierEmail"  /></td>
					  </tr>
					  <tr>
					  		<td>供应商联系人：</td>
					       	<td> <input type="text"  id="stMaintainPerson"  name="supplierBean.stMaintainPerson"  /></td>
					       	<td>供应商等级：</td>
					       	<td> <select  id="stSupplierLevel"  name="supplierBean.stSupplierLevel" >
					       	 		 <option value="1900" selected>普通供应商</option>
						       		 <option value="1901" >中等供应商</option>
						       		 <option value="1902" >VIP供应商</option>
					       		</select></td>
					  </tr>
					  <tr>
					       	<td>是否为子供应商：</td>
					        <td> <select  id="stSub"  name="supplierBean.stSub" >
					       	 		 <option value="1920" selected>总公司</option>
						       		 <option value="1921" >分公司</option>
					       		</select></td>
					  		<td>合并供应商ID：</td>
					       	<td> <input type="text"  id="stCombNumber"  name="supplierBean.stCombNumber"  /></td>
					  		<td>供应商状态:</td>
					       	<td><select id="stState"  name="supplierBean.stState">
						       	     <option value="1000" selected>有效</option>
						       		 <option value="9999" >无效</option>
					       	    </select><font size="5" color="#FF4500">*</font>
					       	</td>
					  </tr>
					   <tr>
					       
					       	<td>用户备注：</td>
					       	<td><textArea  id="stRemark"  name="supplierBean.stRemark" cols="25" rows="4"></textArea> </td>
					  </tr>
				 	</table>
				</form>
		        </td>
		  </tr>
		  <!-- 翻页工具  -->
		  <tr>
		     <td colspan="8">
		     </td>
		  </tr>
	      <tr>
	        <td height="40" colspan="4">
	        	<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
			          <tr>
			            <td></td>
			          </tr>
	        	</table>
	        </td>
	      </tr>
	      <tr>
	        <td width="2%">&nbsp;</td>
	        <td width="51%" class="left_txt"><img src="images/icon-mail2.gif" width="16" height="11"> <br>
	              <img src="images/icon-phone.gif" width="17" height="14"></td>
	        <td>&nbsp;</td>
	        <td>&nbsp;</td>
	      </tr>
	</table>
    </td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
</tr>
<tr>
   <td valign="bottom" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
   <td background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17"></td>
   <td valign="bottom" background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
</tr>
</table>

  </body>
  <script type="text/javascript">
	function submitForm(){  
	    var stSupplierNumber =  document.getElementById("stSupplierNumber").value;  
	    var stSupplierName =  document.getElementById("stSupplierName").value;  
	    var stArea =  document.getElementById("stArea").value;  
	    var stSupplierAddress =  document.getElementById("stSupplierAddress").value;  
	    var stSupplierPostCode =  document.getElementById("stSupplierPostCode").value;  
	    var stSupplierPhone =  document.getElementById("stSupplierPhone").value; 
	    var stSupplierMobile =  document.getElementById("stSupplierMobile").value;
	    var stSupplierEmail =  document.getElementById("stSupplierEmail").value;
	    var stMaintainPerson =  document.getElementById("stMaintainPerson").value;
	    var stSupplierLevel =  document.getElementById("stSupplierLevel").value;
	    var stSub =  document.getElementById("stSub").value;
	    var stCombNumber =  document.getElementById("stCombNumber").value; 
	    var stState =  document.getElementById("stState").value;
	    var stRemark =  document.getElementById("stRemark").value;
		
		if(stSupplierNumber == null || stSupplierNumber == ""){
			alert("供应商编号不能为空");
			return false;
		}
		
		if(stSupplierName == null || stSupplierName == ""){
			alert("供应商名称不能为空");
			return false;
		}
		
		if(stArea == null || stArea == ""){
			alert("供应商区域不能为空");
			return false;
		}
		      
		var  regNumber=/^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$/;
		if(!regNumber.exec(stSupplierMobile)){
			alert("供应商移动电话格式错误");
			return false;
		}
		
		regNumber=/^[0-9]{0,8}$/;
		if(!regNumber.exec(stSupplierPhone)){
			alert("供应商固定电话格式错误");
			return false;
		}
		
		regNumber=/^[0-9a-zA-Z]{0,24}$/;
		if(!regNumber.exec(stSupplierNumber)){
			alert("供应商编号长度或格式出错");
			return false;
		}
		
		var form = document.getElementById("saveSupplierForm");  
		form.submit();   
    }
</script>
</html>
